function padding(num, length) {
  for(let len = (num + "").length; len < length; len = num.length) {
    num = "0" + num;
  }
  return num;
}

/**
 * 获取当前日期时间
 */
export function getCurrentDateTimeForFileName() {
  let date= new Date();
  //年
  let year = new Date().getFullYear();
//月份是从0月开始获取的，所以要+1;
  let month = new Date().getMonth() +1;
//日
  let day = new Date().getDate();
//时
  let hour = new Date().getHours();
//分
  let minute = new Date().getMinutes();
//秒
  let second = new Date().getSeconds();
  let time = year + "" + padding(month, 2) + "" + padding(day, 2) + "" +  padding(hour, 2) + "" + padding(minute, 2) + "" + padding(second, 2);
  return time;
}


/**
 * 获取当前日期时间
 */
export function getCurrentDate() {
  let date= new Date();
  //年
  let year = new Date().getFullYear();
//月份是从0月开始获取的，所以要+1;
  let month = new Date().getMonth() +1;
//日
  let day = new Date().getDate();
//时
  let hour = new Date().getHours();
//分
  let minute = new Date().getMinutes();
//秒
  let second = new Date().getSeconds();
  let time = year + "-" + padding(month, 2) + "-" + padding(day, 2) ;
  return time;
}
